<template>
	<view class="bg_color list_home">
		<Screen :screenData="screenData" :search="search" @changeScreenData="changeScreenData"></Screen>
		<template v-if="listData.length">
			<Scroll :isTriggered="isTriggered" :isXiaLa="total > listData.length" @refresherrefresh="refresherrefresh" @scrolltolower="scrolltolower">
				<Add title="新增实有房屋" @add="add"></Add>
				<view class="pdd32 content">
					<view class="address_item" v-for="(item, index) in listData" :key="item.id">
						<view class="top flex_center">
							<view class="top_tittle" @click="() => clickItem(item.id)">{{ item.name }}</view>
							<view class="list_caoZo" @click="() => operate(item)" v-if="!store.isFuJing() && store.isMe(item.userId) && !item.reportStatus">
								<up-icon size="32rpx" :name="config.getImage('more')"></up-icon>
							</view>
						</view>
						<view class="" @click="() => clickItem(item.id)">
							<view class="con">
								<view class="font28 tit_con1">业主姓名</view>
								<view class="font28 tex1">{{ item.status == 1 ? item.houseName : config.encryptionChange(item.houseName) }}</view>
							</view>
							<view class="con">
								<view class="font28 tit_con1">业主联系方式</view>
								<view class="font28 tex1">{{ item.status == 1 ? item.phone : config.encryptionChange(item.phone) }}</view>
							</view>
							<view class="con">
								<view class="font28 tit_con1">房屋类型</view>
								<view class="font28 tex1">{{ item.houseType_dictText }}</view>
							</view>
							<view class="con">
								<view class="font28 tit_con1">面积</view>
								<view class="font28 tex1">{{ item.houseArea }}</view>
							</view>
							<view class="con">
								<view class="font28 tit_con1">结构</view>
								<view class="font28 tex1">{{ item.houseBuild }}</view>
							</view>
							<view class="con">
								<view class="font28 tit_con1">用途</view>
								<view class="font28 tex1">{{ item.houseProperty_dictText }}</view>
							</view>
							<view class="con">
								<view class="font28 tit_con1">详细地址</view>
								<view class="font28 tex1 dizhi">{{ item.place }}</view>
							</view>
							<view class="con">
								<view class="font28 tit_con1">当前状态</view>
								<view class="state_view" :class="colorList[item.status].className">
									<view class="drop"></view>
									<view class="state font28">{{ colorList[item.status].name }}</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</Scroll>
		</template>
		<NoData v-else :show="screenData.status != 0 || screenData.keywords != ''">
			<view class="font28">还没有新增过实有房屋!</view>
			<view class="no_btn font28" @click="add">新增实有房屋</view>
		</NoData>
		<DeleteState v-if="isDelete" :success="success" @successReturn="fanhui" @failReturn="fanhui"></DeleteState>
	</view>
	<Operate :show="show" @editItem="editItem" @deleteItem="deleteItem" @close="show = false"></Operate>
	<DeleteModal :deleteShow="deleteShow" @confirm="confirm" @close="deleteShow = false"></DeleteModal>
</template>
<script>
const colorList = {
	2: {
		name: '已核查',
		className: 'green'
	},
	1: {
		name: '未核查',
		className: 'red'
	},
	3: {
		name: '已上报',
		className: 'blue'
	}
};
const search = {
	type: 'status',
	text: 'keywords',
	searchList: [
		{ name: '全部', value: '0' },
		{ name: '未核查', value: '1' },
		{ name: '已核查', value: '2' },
		{ name: '已上报', value: '3' }
	]
};
</script>
<script setup>
import config from '@/config.js';
import Screen from 'com/Screen.vue';
import ListITem from 'com/ListITem.vue';
import DeleteModal from 'com/modal/DeleteModal.vue';
import DeleteState from 'com/modal/DeleteState.vue';
import NoData from 'com/modal/NoData.vue';
import Operate from 'com/Operate.vue';
import Add from 'com/Add.vue';
import Scroll from 'com/Scroll.vue';
import { useGetData } from 'hooks';
import { usersStore } from 'store/users.js';
const store = usersStore();
const {
	total,
	success,
	confirm,
	fanhui,
	editItem,
	isDelete,
	setTotal,
	screenData,
	scrolltolower,
	refresherrefresh,
	add,
	isTriggered,
	listData,
	changeScreenData,
	clickItem,
	operateItem,
	setOperateItem,
	operate,
	show,
	deleteItem,
	deleteShow
} = useGetData('baseHouseInfo', 'house');
</script>

<style lang="scss" scoped>
	
</style>
